﻿using System.Linq.Expressions;

namespace Infrastructure.DDD
{
    public interface IRepository<T> where T : IEntity
    {
        Task SaveChangesAsync(CancellationToken cancellationToken = default);
        void Add(T entity);
        //Task AddAsync(T entity);
        void AddRange(List<T> entity);
        Task AddRangeAsync(List<T> entity);
        void Remove(T entity);
        void RemoveRange(List<T> entity);
        void Update(T entity);
        void UpdateRange(List<T> entity);
        T FindById(int id);
        Task<T> FindByIdAsync(int id);
        Task<T> FindByIdWithIncludeAsync<TProperty>(int id, Expression<Func<T, TProperty>> navigationProperty);
        IQueryable<T> AsQueryable();
    }
}
